import requests


class IhrmApi:
    # 获取登录接口
    @classmethod
    def login(cls, data):
        url = "http://ihrm-test.itheima.net/api/sys/login"
        header = {"Content-Type": "application/json"}
        resp = requests.post(url=url, headers=header, json=data)
        return resp

    # 获取添加员工接口
    @classmethod
    def add(cls, header, data):
        url = "http://ihrm-test.itheima.net/api/sys/user"
        resp = requests.post(url=url, headers=header, json=data)
        return resp

    # 获取查找员工接口
    @classmethod
    def Search(cls, emp_id, header):
        url = "http://ihrm-test.itheima.net/api/sys/user/" + emp_id
        resp = requests.get(url=url, headers=header)
        return resp

    # 获取修改员工接口
    @classmethod
    def update(cls, emp_id, header, data):
        url = "http://ihrm-test.itheima.net/api/sys/user/" + emp_id
        resp = requests.put(url=url, headers=header, json=data)
        return resp

    # 获取删除员工接口
    @classmethod
    def delete(cls, emp_id, header):
        url = "http://ihrm-test.itheima.net/api/sys/user/" + emp_id
        resp = requests.delete(url=url, headers=header)
        return resp
